package com.peanut.bosskg.util;

/**
 * @author peanut
 */
public class StringUtils extends org.springframework.util.StringUtils {
    /**
     * 切割较长字符串（>length）为短字符串
     *
     * @param longString 原始字符串
     * @param length     切割后字符串长度
     * @return
     */
    public static String cutLongString(String longString, int length) {
        if (StringUtils.isEmpty(longString)) {
            return "";
        }
        StringBuilder sb = new StringBuilder();

        if (longString.length() > length) {
            sb.append(longString, 0, length).append("...(length=").append(longString.length()).append(")");
            return sb.toString();
        }
        return longString;

    }
}
